[RTL8722DM_MINI] SDFS 数据编辑
材料准备
Ameba RTL8722DM_MINI x 1
MicroSD卡 x 1 (SD卡必须 < 32GB,格式设置为 fatfs)
范例说明
SD文件系统模块支持SD卡数据操作。可以随时控制和查看文件,并将它们保存在非挥发性内存中。
将以下代码逐行复制粘贴到REPL中来使用。
1from machine import SDFS
2s=SDFS() # create a short form
3s.create("ameba.txt") # create a file named "ameba.txt"
4s.write("ameba.txt", "ameba supports sd card file system!") # write a string to the file just created
5s.read("ameba.txt") # read the content from the same file
6s.rm("ameba.txt") # delete the file
注解
不需要打开或关闭文件,API 会自动为您完成。